#pragma once
#include <iosfwd>
#include <string>

// 动态库导出宏定义
#ifdef _WIN32
#ifdef MESSAGE_EXPORTS
#define MESSAGE_API __declspec(dllexport)
#else
#define MESSAGE_API __declspec(dllimport)
#endif
#else
#define MESSAGE_API  // Linux/macOS无特殊处理
#endif

class MESSAGE_API Message {  // 应用导出宏
public:
    Message(const std::string& m) : message_(m) {}

    friend std::ostream& operator<<(std::ostream& os, Message& obj) {
        return obj.printObject(os);
    }

private:
    std::string message_;
    std::ostream& printObject(std::ostream& os);  // 接口自动导出
};